package cn.tedu.ivos.geofence.controller;

import cn.tedu.ivos.base.response.JsonResult;
import cn.tedu.ivos.geofence.pojo.dto.GeofenceQuery;
import cn.tedu.ivos.geofence.pojo.dto.GeofenceSaveParam;
import cn.tedu.ivos.geofence.pojo.vo.GeofenceVO;
import cn.tedu.ivos.geofence.service.GeofenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.spring.web.json.Json;

import java.util.List;

@RestController
@RequestMapping("/v1/geofence/")
public class GeofenceController {

    @Autowired
    private GeofenceService service;

    @GetMapping("query")
    public JsonResult query(GeofenceQuery geofenceQuery) {
        List<GeofenceVO> list = service.query(geofenceQuery);
        return JsonResult.ok(list);
    }


    @PostMapping("save")
    public JsonResult save(GeofenceSaveParam geofenceSaveParam)
    {
        System.out.println("geofenceSaveParam = "+geofenceSaveParam);
        service.save(geofenceSaveParam);
        return JsonResult.ok();
    }

    @PostMapping("del/{id}")
    public JsonResult del(@PathVariable Long id)
    {
        service.del(id);
        return JsonResult.ok();
    }

}
